#!/bin/bash
# 注意：这个只是测试数据库，没有加载数据库的过程，要配合在load_db.sh加载完对应数据库之后使用。
cd ../build

start_time=$(date +%s) # %s可以计算的是1970年以来的秒数

sudo ./all_put_all_get_ar -f ../db/dataset/amazon_reviews.txt -k 16 -v 64 -d ../ssd/db_ar_16 -m 7 -w -l 3 > ../evaluation/ar_16_put.txt

sync; echo 3 | sudo tee /proc/sys/vm/drop_caches
sudo ./all_put_all_get_ar -f ../db/dataset/amazon_reviews.txt -k 16 -v 64 -d ../ssd/db_ar_16 -m 7 -u -n 10000 -i 1 $* --change_level_load > ../evaluation/ar_16_llsm.txt
sudo ./all_put_all_get_ar -f ../db/dataset/amazon_reviews.txt -k 16 -v 64 -d ../ssd/db_ar_16 -m 8 -u -n 10000 -i 1 $* --change_level_load > ../evaluation/ar_16_baseline.txt
sudo ./all_put_all_get_ar -f ../db/dataset/amazon_reviews.txt -k 16 -v 64 -d ../ssd/db_ar_16 -m 7 -u -n 10000 -i 1 $* > ../evaluation/ar_16_llsm_level.txt

cd ../learned-leveldb/
python ./scripts/collect_results.py 1 ar_16 > ../evaluation/expr_dataset_ar_16.txt
cat ../evaluation/expr_dataset_ar_16.txt

end_time=$(date +%s)
cost_time=$((end_time-start_time))
echo "$0" "运行时间：$((cost_time/60))min $((cost_time%60))s"